﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace PuzzleCrawler
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int package = 1; package < 30; package++)
            {
                if(!Directory.Exists(package.ToString()))
                {
                    Directory.CreateDirectory(package.ToString());
                }
                for (int i = 1; i <= 100; i++)
                {
                    PuzzleCrawlTask task = new PuzzleCrawlTask();
                    task.Id = (package - 1) * 100 + i;
                    task.Path = String.Format("{0}/{1}.map", package, i);
                    task.Start();
                    task.TaskFinished += new EventHandler<CrazyReader.Core.Crawl.TaskFinishedEventArgs>(task_TaskFinished);
                }
            }
            Console.ReadKey();
        }

        static void task_TaskFinished(object sender, CrazyReader.Core.Crawl.TaskFinishedEventArgs e)
        {
            PuzzleCrawlTask task = sender as PuzzleCrawlTask;
            Console.WriteLine("地图：" + task.Id + "，解析完成");
        }
    }
}
